<%@codepage="65001"%>
<%session.codepage="65001"%>
<!-- #include virtual=/inc/dbConn.asp -->
<!-- #include virtual=/inc/function.asp -->
<!-- #include virtual=/inc/action.header.inc.asp -->

<%
	'## 파라미터 변수 선언부
	fullLotNo		= Request("fullLotNo")
	lotSubNo		= Request("lotSubNo")
	
	SQLTitle = "-- ■■■■ 작업지시 상세 정보 ■■■■"
	
	SQL = " SELECT A.lotYear+A.lotNo fullLotNo, lotSubNo, A.compCd, B.company, A.prdCd, A.qty, A.deliveryDt, A.procTypeCd, A.sourceLotNo, A.sourceSize, A.type, ISNULL(A.ingQty,0) ingQty, A.compOrderArticleSeq, A.flag, A.restQty " & _
		  " , ISNULL(A.amount,0) amount, A.compMemo, A.workMemo, A.remarks, A.planDt, ISNULL(C.processNm,'준비') curProcess,  CAST(ISNULL(A.badRate,0) as VARCHAR(10)) badRate, A.orgSrcCd, A.orgSrcCnt " & _
		  " , CASE WHEN A.updateDt IS NULL THEN A.issueDt ELSE A.updateDt END updateDt " & _
		  " FROM tblOrder A LEFT JOIN tblCompany B ON A.compCd=B.compCd " & _ 
		  "		LEFT JOIN tblUnitProcess C ON A.curProcessCd=C.processCd " & _
		  " WHERE A.lotYear+A.lotNo='" & fullLotNo & "' AND A.lotSubNo=" & lotSubNo

	If xMode="debug" Then 
		Call showDebug(SQLTitle,SQL) 
	End If 

	Set Rs=Server.CreateObject("ADODB.RecordSet")
	Rs.open SQL, DbCon, 1
	
	Response.write "<OrderDetail>" & vbcrlf

	If Rs.eof Or Rs.bof Then 
	Else 
		Do Until Rs.eof Or Rs.bof
			badRate = rs("badRate")
			If badRate = "100.000" Then 
				badRate = "100"
			ElseIf badRate = "0.000" Then 
				badRate = "0"
			End If 

			Call mkXMLNode("fullLotNo", rs("fullLotNo"), 1)
			Call mkXMLNode("lotSubNo", rs("lotSubNo"), 1)
			Call mkXMLNode("compCd", rs("compCd"), 1)
			Call mkXMLNode("company", rs("company"), 1)
			Call mkXMLNode("prdCd", rs("prdCd"), 1)
			Call mkXMLNode("qty", rs("qty"), 1)
			Call mkXMLNode("ingQty", FormatNumber(rs("ingQty"),0), 1)
			Call mkXMLNode("deliveryDt", rs("deliveryDt"), 1)
			Call mkXMLNode("procTypeCd", rs("procTypeCd"), 1)
			Call mkXMLNode("sourceLotNo", rs("sourceLotNo"), 1)
			Call mkXMLNode("sourceSize", rs("sourceSize"), 1)
			Call mkXMLNode("type", rs("type"), 1)
			Call mkXMLNode("amount", FormatNumber(rs("amount"),0), 1)
			Call mkXMLNode("restQty", rs("restQty"), 1)
			Call mkXMLNode("compMemo", rs("compMemo"), 1)
			Call mkXMLNode("workMemo", rs("workMemo"), 1)
			Call mkXMLNode("remarks", rs("remarks"), 1)
			Call mkXMLNode("orgSrcCnt", rs("orgSrcCnt"), 1)
			Call mkXMLNode("orgSrcCd", rs("orgSrcCd"), 1)
			Call mkXMLNode("compOrderArticleSeq", rs("compOrderArticleSeq"), 1)
			Call mkXMLNode("planDt", rs("planDt"), 1)
			Call mkXMLNode("curProcess", rs("curProcess"), 1)
			Call mkXMLNode("updateDt", rs("updateDt"), 1)
			Call mkXMLNode("badRate", badRate, 1)
			Call mkXMLNode("flag", Rs("flag"), 1)

		Rs.movenext
		Loop 
	End If
	Response.write "</OrderDetail>" & vbcrlf
'	Call rsWithXML("Save OK!")
%>